package com.blb.wuliu.interceptor;

import com.blb.wuliu.entity.Address;
import com.blb.wuliu.entity.Good;
import com.blb.wuliu.service.AddressService;
import com.blb.wuliu.service.GoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author lvtian
 * @date 2023/1/5 20:15
 */
public class DropBoxInterceptor implements HandlerInterceptor {
    @Autowired
    private GoodService goodService;
    @Autowired
    private AddressService addressService;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        List<Good> goodsList = goodService.list();
        List<Address> addressList = addressService.list();
        request.setAttribute("goodsList",goodsList);
//        request.setAttribute("addressList",addressList);
        return true;
    }
}
